package cn.faifai.desktop.view.components.menus;

import cn.faifai.desktop.events.ShowFileTaggingDialogEvent;
import cn.faifai.framework.utils.SingleEvenBus;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;

public class FileListMenu {
    private ContextMenu contextMenu;

    private FileListMenu(){
        contextMenu = new ContextMenu();

        MenuItem item2 = new MenuItem("关联标签");
        item2.setOnAction(e -> {
            System.out.println("你选择了: " + "关联标签");
            SingleEvenBus.getInstance().post(new ShowFileTaggingDialogEvent());

        });

        contextMenu.getItems().addAll(item2);
    }

    public static class SingletonHolder {
        private static final FileListMenu INSTANCE = new FileListMenu();


    }

    public static FileListMenu getInstance(){
        return FileListMenu.SingletonHolder.INSTANCE;
    }

    public static ContextMenu getMenu() {
        return FileListMenu.SingletonHolder.INSTANCE.contextMenu;
    }
}
